<?php

namespace app\shop\controller;
use Throwable;
use app\common\controller\PCBase;
use app\common\controller\DBase;
use app\shop\logic\ShopLogic;
use think\facade\Db;

class Shop extends DBase
{
    /**
     * @desc  获取店铺信息
     * @author luckyXiong
     * @date   2024-07-02
     */
    public function index()
    {

        $params = $this->request->post();
        return (new ShopLogic())->getShopsList($params);
    }


    /**
     * @desc   获取店铺信息
     * @author luckyXiong
     * @date   2024-06-24
     */
    public function update_shop_info(){
        $params = $this->request->post();
        if(empty($params)){
            $params = $this->request->get();
        }
        return (new ShopLogic())->update_shop_info($params);
    }


    /**
     * @desc   获取店铺列表消息
     * @author luckyXiong
     * @date   2024-06-28
     */
    public function getShopList(){
        $params = $this->request->post();
        return (new ShopLogic())->getShopInfo($params);
    }

    /**
     * @desc   开户主体列表
     * @author zhangheng
     * @date   2024-06-28
     */
    public function CompanyList(){
        $params = $this->request->post();
        return (new ShopLogic())->CompanyList($params);
    }

    /**
     * @desc  获取运营列表
     * @author zhangheng
     * @date   2024-07-08
     */
    public function SalesmanList()
    {

        $params = $this->request->post();
        return (new ShopLogic())->getSalesmanList($params);
    }


    /**
     * @desc  获取在职运营列表
     * @author zhangheng
     * @date   2024-07-08
     */
    public function getOnSales()
    {

        $params = $this->request->post();
        $keyword    = $params['keyword']??'';
        $pattern    = '/^[a-zA-Z0-9]+$/';
        if($keyword){
            if(preg_match($pattern, $keyword)) {
                $params['tel']         = $keyword;
            } else {
                $params['username']    = $keyword;
            }
        }
        return (new ShopLogic())->getOnSales($params);
    }



    /**
     * @desc   店铺编辑
     * @author luckyXiong
     * @date   2024-07-17
     */
    public function edit()
    {
        $params = $this->request->post();
        return (new ShopLogic())->edit_list($params);
    }
    /**
     * @desc   店铺添加
     * @author zhangheng
     * @date   2024-07-17
     */
    public function add()
    {
        $params = $this->request->post();
        return (new ShopLogic())->add($params);
    }


    /**
     * @desc   获取在职运营列表接口
     * @author luckyXiong
     * @date   2024-11-07
     */
    public function getSaleOn()
    {
        $params = $this->request->post();
        return (new ShopLogic())->getSaleOn($params);
    }






    /**
     * @desc   获取站点下拉数据
     * @author luckyXiong
     * @date   2024-08-05
     */
    public function getSiteList()
    {
        $params = $this->request->post();
        return (new ShopLogic())->getSiteList($params);
    }



    /**
     * AscriptionList归属列表
     * @throws Throwable
     */
    public function AscriptionList()
    {
        $params     = $this->request->post();
        $ShopLogic = new ShopLogic();
        return $ShopLogic->AscriptionList($params);
    }

    /**
     * AscriptionList归属添加
     * @throws Throwable
     */
    public function AscriptionAdd()
    {
        $params     = $this->request->post();
        $ShopLogic = new ShopLogic();
        return $ShopLogic->AscriptionAdd($params);
    }
    /**
     * AscriptionList归属修改
     * @throws Throwable
     */
    public function AscriptionEdit()
    {
        $params     = $this->request->post();
        $ShopLogic = new ShopLogic();
        return $ShopLogic->AscriptionEdit($params);
    }




}